<template>
  <el-col class="info-wrapper" :span="23">
    <el-form
      ref="form"
      :model="searchParams"
      class="search-from main-content"
      label-width="120px"
    >
      <el-col class="search-col">
        <el-form-item label="企业名称" prop="companyName">
          <el-input v-model="searchParams.companyName"></el-input>
        </el-form-item>
        <el-form-item label="合同编号" prop="contractId">
          <el-input v-model="searchParams.contractId"></el-input>
        </el-form-item>
        <el-form-item label="合作单位" prop="cooperativeUnits">
          <el-input v-model="searchParams.cooperativeUnits"></el-input>
        </el-form-item>
      </el-col>
      <el-col class="search-col">
        <el-form-item label="计划日期" prop="planStartTime">
          <el-date-picker
            v-model="searchParams.planStartTime"
            type="date"
            placeholder="选择日期">
          </el-date-picker>
        </el-form-item>
        <el-form-item label="至" prop="planEndTime">
          <el-date-picker
            v-model="searchParams.planEndTime"
            type="date"
            placeholder="选择日期">
          </el-date-picker>
        </el-form-item>
      </el-col>
      <el-col class="search-col operation-area">
        <el-button type="primary" @click="search">搜索</el-button>
        <el-button @click="reset">清空</el-button>
        <el-button @click="batchExport">批量导出</el-button>
      </el-col>
    </el-form>

    <el-tabs class="table-tabs" type="border-card">
      <el-tab-pane>
        <span slot="label">所有项目 {{ tableData.length }}</span>
        <el-table border :data="tableData">
          <el-table-column prop="date" label="审核类型"> </el-table-column>
          <el-table-column prop="date" label="状态"> </el-table-column>
          <el-table-column prop="date" label="申请编号"> </el-table-column>
          <el-table-column prop="date" label="企业名称"> </el-table-column>
          <el-table-column prop="date" label="标准"> </el-table-column>
          <el-table-column prop="date" label="计划开始"> </el-table-column>
          <el-table-column prop="date" label="最后审核日期"> </el-table-column>
          <el-table-column prop="date" label="产品人数"> </el-table-column>
          <el-table-column prop="date" label="产品小类"> </el-table-column>
          <el-table-column prop="date" label="产品名称"> </el-table-column>
          <el-table-column prop="date" label="范围"> </el-table-column>
          <el-table-column prop="operation" label="操作">
            <template slot-scope="scope">
              <el-link type="primary" @click="toDetail(scope.row)">详情</el-link>
            </template>
          </el-table-column>
        </el-table>
      </el-tab-pane>
    </el-tabs>
  </el-col>
</template>

<script>
export default {
  name: "certificateSearch",
  data() {
    return {
      defulatParams: {
        companyName: "", // 企业名称
        contractId: "", // 合同编号
        cooperativeUnits: "", // 合作单位
        planStartTime: "", // 计划日期
        planEndTime: "" // 至（计划日期）
      },
      searchParams: {
        ...this.defulatParams,
      },
      tableData: [{ date: 123 }] // 表格数据
    };
  },
  mounted() {
    this.queryTableData();
  },
  methods: {
    search() {
      // todo: 搜索方法
    },
    reset() {
      this.searchParams = {
        ...this.defulatParams
      };
      this.search();
    },
    batchExport() {
      // todo: 批量导出方法
    },
    queryTableData() {
      // todo：获取表格数据
    },
    toDetail(row) {
      this.$router.push({
        path: "/product/apply/change/detail",
        query: row
      });
    }
  },
};
</script>

<style lang="less" scoped>
.info-wrapper {
  font-family: Source Han Sans CN;
  font-weight: 400;
  height: 100%;

  .search-from {
    display: flex;
    flex-wrap: wrap;
    border: 1px solid #c2d9e6;
    padding-top: 20px;

    .search-col {
      display: flex;
    }

    .operation-area {
      margin-left: 20px;
      margin-bottom: 10px;
    }
  }

  .table-tabs {
    margin-top: 15px;
  }

  .operation-col {
    white-space: 5px;
  }
}
</style>
